package com.yunxi.service.localService.impl.otd;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yunxi.core.service.ServiceImplPlus;
import com.yunxi.core.web.ApiResult;
import com.yunxi.core.web.ResponseUtil;
import com.yunxi.dao.otd.OtdPlanChangeApplyMapper;
import com.yunxi.model.otd.OtdPlanChangeApply;
import com.yunxi.otd.pojo.OtdPlanChangeApplyVO;
import com.yunxi.service.localService.otd.OtdChangeApplyPlanService;
import java.util.List;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 生产计划 服务实现类
 * </p>
 *
 * @author XUQI
 * @since 2019-05-24
 */
@Service
public class OtdChangeApplyPlanServiceImpl extends ServiceImplPlus<OtdPlanChangeApplyMapper, OtdPlanChangeApply> implements
    OtdChangeApplyPlanService {

    @Override
    public OtdPlanChangeApplyVO load(String applyId) {
        return baseMapper.load(applyId);
    }

    @Override
    public ApiResult removeByIds(List<String> ids) {
        LambdaQueryWrapper<OtdPlanChangeApply> wrapper = new LambdaQueryWrapper<>();
        wrapper.in(OtdPlanChangeApply::getState, "1","3").in(OtdPlanChangeApply::getPlanChangeApplyId, ids);
        baseMapper.delete(wrapper);
        return ResponseUtil.ok();
    }
}
